package Text_42;

import java.util.ArrayList;
import java.util.Scanner;

public class Code {

	public static void main(String[] args) {
		//自除数
		Scanner sc = new Scanner(System.in);
        ArrayList<Integer> list = new ArrayList<>();
        ArrayList<Object> list2 = new ArrayList<>();
        //范围
        int left = sc.nextInt();
        int right = sc.nextInt();
        for (int i = left; i <=right ; i++) {
        	//判断是否有0
            if(i%10==0){
                continue;
            }else{
                if(!getNum(i)){
                    continue;
                }else{
                	//放入集合
                    list.add(i);
                }
            }
        }
//        for (int i = 0; i <list.size() ; i++) {
//            System.out.print(list.get(i)+" ");
//        }
        //输出
        System.out.println(getString(list,list2));
    }
    public static boolean getNum(int num){
        ArrayList<Integer> list = new ArrayList<>();
        int num1 = num;
        while(num1>=1){
            int ge = num1%10;//获取个位
            num1 = num1/10;
            list.add(ge);
        }
        for (int i = 0; i <list.size() ; i++) {
            if(num%list.get(i)!=0) {
                return false;
            }
        }
        return true;
    }
    public static ArrayList<Object> getString(ArrayList<Integer> list,ArrayList<Object> list2){

        for (int i = 0; i <list.size() ; i++) {
            list2.add(list.get(i));
        }
        return list2;

	}

}
